In [13]:
import pandas as pd
from sklearn.model_selection import train_test_split
import joblib
import numpy as np
from sklearn.feature_selection import VarianceThreshold, SelectKBest, f_classif
In [14]:
# Show all columns in the DataFrame
pd.set_option('display.max_columns', None)
pd.set_option('display.width', None)
In [15]:
# Load raw data
#benign = pd.read_csv('datasets/hmi_normal_6h_flow_label.csv')
scapy_modify = pd.read_csv('datasets/mitm_hmi_scapy_modify_1plc_6h_flow_label.csv')
fw_36plc = pd.read_csv('datasets/mitm_hmi_forward_36plc_6h_flow_label.csv')
In [16]:
scapy_modify.groupby("Label").describe()
Out[16]:
Src Port Dst Port Protocol Flow Duration Tot Fwd Pkts Tot Bwd Pkts TotLen Fwd Pkts TotLen Bwd Pkts Fwd Pkt Len Max Fwd Pkt Len Min Fwd Pkt Len Mean Fwd Pkt Len Std Bwd Pkt Len Max Bwd Pkt Len Min Bwd Pkt Len Mean Bwd Pkt Len Std Flow Byts/s Flow Pkts/s Flow IAT Mean Flow IAT Std Flow IAT Max Flow IAT Min Fwd IAT Tot Fwd IAT Mean Fwd IAT Std Fwd IAT Max Fwd IAT Min Bwd IAT Tot Bwd IAT Mean Bwd IAT Std Bwd IAT Max Bwd IAT Min Fwd PSH Flags Bwd PSH Flags Fwd URG Flags Bwd URG Flags Fwd Header Len Bwd Header Len Fwd Pkts/s Bwd Pkts/s Pkt Len Min Pkt Len Max Pkt Len Mean Pkt Len Std Pkt Len Var FIN Flag Cnt SYN Flag Cnt RST Flag Cnt PSH Flag Cnt ACK Flag Cnt URG Flag Cnt CWE Flag Count ECE Flag Cnt Down/Up Ratio Pkt Size Avg Fwd Seg Size Avg Bwd Seg Size Avg Fwd Byts/b Avg Fwd Pkts/b Avg Fwd Blk Rate Avg Bwd Byts/b Avg Bwd Pkts/b Avg Bwd Blk Rate Avg Subflow Fwd Pkts Subflow Fwd Byts Subflow Bwd Pkts Subflow Bwd Byts Init Fwd Win Byts Init Bwd Win Byts Fwd Act Data Pkts Fwd Seg Size Min Active Mean Active Std Active Max Active Min Idle Mean Idle Std Idle Max Idle Min
count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max
Label
mitm 6754.0 45706.734972 5553.484326 32784.0 44818.0 44818.0 45037.0 60992.0 6754.0 45878.698253 6111.837581 32784.0 44818.0 44818.0 47685.5 60992.0 6754.0 6.0 0.0 6.0 6.0 6.0 6.0 6.0 6754.0 434630.275540 1.566391e+06 14.0 35.0 616202.5 792774.25 99088176.0 6754.0 2.449067 2.457426 0.0 0.0 4.0 5.0 6.0 6754.0 3.553154 1.569620 1.0 2.0 5.0 5.0 8.0 6754.0 47.787385 48.099579 0.0 0.0 72.0 98.0 168.0 6754.0 38.269174 38.660947 0.0 0.0 72.0 72.0 100.0 6754.0 33.752147 34.166059 0.0 0.0 44.0 70.0 72.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 9.749585 9.755739 0.0 0.0 18.0 19.6 28.0 6754.0 14.920295 15.028194 0.0 0.0 21.786846 30.672463 34.292856 6754.0 24.265028 24.886134 0.0 0.0 44.0 44.0 72.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 7.480942 7.496550 0.0 0.0 12.375 14.4 16.666667 6754.0 11.012655 11.146532 0.0 0.0 20.51341 20.513410 29.330303 6754.0 106.448680 107.724388 0.0 0.0 1.992790 216.632122 338.550777 6754.0 35418.533351 39916.649455 0.121104 12.613931 16.231172 57142.857143 142857.142857 6754.0 47810.307408 144692.168035 14.0 35.0 69502.5 88088.583333 9.008016e+06 6754.0 61929.003762 455455.016393 0.0 0.0 75823.085052 105804.078147 2.963342e+07 6754.0 165512.691146 1.508231e+06 14.0 35.0 194066.0 276949.75 98355743.0 6754.0 63.708617 1664.419176 13.0 20.0 29.0 38.0 100501.0 6754.0 314562.587060 315999.420297 0.0 0.0 470988.5 628555.0 776518.0 6754.0 81354.608528 82457.804395 0.0 0.0 118766.25 158968.375 252569.00 6754.0 74244.508187 75455.695403 0.0 0.0 65767.341155 151067.292561 201558.904417 6754.0 154264.025318 155730.636886 0.0 0.0 204687.0 307223.25 438777.0 6754.0 6640.931744 18928.241434 0.0 0.0 1958.0 6095.25 135708.0 6754.0 431217.406574 1.565578e+06 0.0 35.0 609929.0 785992.25 99088176.0 6754.0 102895.405747 237557.336597 0.0 35.0 126171.9 194004.9125 1.415545e+07 6754.0 60112.545143 569092.745766 0.0 0.0 57030.169689 98073.563059 3.712901e+07 6754.0 173616.759994 1.508831e+06 0.0 35.0 213070.0 293905.25 98355743.0 6754.0 38636.816849 43667.114064 0.0 35.0 105.5 81205.25 151454.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 78.790643 78.922803 0.0 0.0 136.0 160.0 192.0 6754.0 121.288126 57.548323 44.0 64.0 176.0 176.0 264.0 6754.0 3.035348 3.084742 0.0 0.0 3.770851 6.213025 15.614265 6754.0 35415.498003 39919.342230 0.080736 6.368036 9.511096 57142.857143 142857.142857 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 35.010364 35.021639 0.0 0.0 68.0 70.0 72.0 6754.0 7.821808 7.821432 0.0 0.0 13.153846 15.636364 20.000000 6754.0 12.154557 12.152875 0.0 0.0 22.905756 24.371369 27.804512 6754.0 295.403750 295.439760 0.0 0.0 524.717949 593.963636 773.090909 6754.0 0.499704 0.500037 0.0 0.0 0.0 1.0 1.0 6754.0 0.499852 0.500037 0.0 0.0 0.0 1.0 1.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.500148 0.500037 0.0 0.0 1.0 1.0 1.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.500444 0.500629 0.0 0.0 1.0 1.0 2.0 6754.0 8.603843 8.603407 0.0 0.0 14.25 17.2 21.818182 6754.0 9.749585 9.755739 0.0 0.0 18.0 19.6 28.0 6754.0 7.480942 7.496550 0.0 0.0 12.375 14.4 16.666667 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 2.449067 2.457426 0.0 0.0 4.0 5.0 6.0 6754.0 47.787385 48.099579 0.0 0.0 72.0 98.0 168.0 6754.0 3.553154 1.569620 1.0 2.0 5.0 5.0 8.0 6754.0 38.269174 38.660947 0.0 0.0 72.0 72.0 100.0 6754.0 -1.0 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 6754.0 83.896062 0.994657 83.0 83.0 83.0 85.0 85.0 6754.0 1.000740 1.000740 0.0 0.0 2.0 2.0 3.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.008884 0.549823 0.0 0.0 0.0 0.0 41.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.008884 0.549823 0.0 0.0 0.0 0.0 41.0 6754.0 0.008884 0.549823 0.0 0.0 0.0 0.0 41.0 6754.0 25647.077584 1.503937e+06 0.0 0.0 0.0 0.0 98355743.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 25647.077584 1.503937e+06 0.0 0.0 0.0 0.0 98355743.0 6754.0 25647.077584 1.503937e+06 0.0 0.0 0.0 0.0 98355743.0
normal 164457.0 45785.487161 5607.404711 32768.0 44818.0 44818.0 45764.0 60998.0 164457.0 45946.057510 6071.042539 32768.0 44818.0 44818.0 48036.0 60998.0 164457.0 6.0 0.0 6.0 6.0 6.0 6.0 6.0 164457.0 58148.334805 1.424615e+06 7.0 14.0 57859.0 73380.00 117511126.0 164457.0 2.459804 2.466897 0.0 0.0 4.0 5.0 6.0 164457.0 3.541515 1.553819 2.0 2.0 5.0 5.0 8.0 164457.0 47.981515 48.193465 0.0 0.0 72.0 96.0 100.0 164457.0 38.461665 38.756286 0.0 0.0 72.0 78.0 100.0 164457.0 33.978535 34.284204 0.0 0.0 44.0 68.0 72.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 9.749339 9.753269 0.0 0.0 18.0 19.2 20.0 164457.0 14.990621 15.069873 0.0 0.0 21.786846 29.852973 31.496031 164457.0 24.458685 24.926832 0.0 0.0 44.0 50.0 72.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 7.558702 7.572162 0.0 0.0 12.000 15.6 16.666667 164457.0 11.102558 11.203735 0.0 0.0 20.51341 22.733236 29.330303 164457.0 1164.924351 1180.243370 0.0 0.0 1.803155 2355.486778 3057.083121 164457.0 71186.095216 78249.038332 0.102118 136.278772 172.962502 142857.142857 285714.285714 164457.0 6053.155641 129522.082678 7.0 14.0 6424.0 8153.222222 1.068283e+07 164457.0 13498.581455 429158.498273 0.0 0.0 11627.964869 13719.697409 3.540754e+07 164457.0 43585.339639 1.423458e+06 7.0 14.0 36986.0 43238.00 117440559.0 164457.0 16.784807 9.151835 4.0 11.0 14.0 22.0 2064.0 164457.0 34062.665639 34647.273340 0.0 0.0 50543.0 66317.0 156975.0 164457.0 8727.146386 8898.843536 0.0 0.0 13176.00 16922.000 39243.75 164457.0 10256.294977 10501.460605 0.0 0.0 14713.764316 19285.950368 68549.944913 164457.0 23079.325629 23513.684397 0.0 0.0 37016.0 43284.00 141872.0 164457.0 1221.682902 1431.210742 0.0 0.0 1239.0 2082.00 19406.0 164457.0 55162.797917 1.424580e+06 7.0 14.0 54144.0 67067.00 117511126.0 164457.0 11443.127877 203580.924270 7.0 14.0 11946.6 16542.2500 1.678730e+07 164457.0 17682.778109 537956.338481 0.0 0.0 14333.896201 18761.503636 4.438392e+07 164457.0 43794.498726 1.423459e+06 7.0 14.0 37471.0 43664.00 117440559.0 164457.0 1716.652025 2087.730052 7.0 14.0 103.0 3182.00 13849.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 79.039846 79.159871 0.0 0.0 136.0 160.0 192.0 164457.0 121.004080 57.193933 64.0 64.0 176.0 176.0 264.0 164457.0 33.152261 33.689838 0.0 0.0 0.041677 67.281168 96.677516 164457.0 71152.942954 78279.141975 0.068079 68.809865 100.446989 142857.142857 285714.285714 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 34.897913 34.918514 0.0 0.0 66.0 68.0 72.0 164457.0 7.857901 7.856737 0.0 0.0 13.384615 15.636364 15.818182 164457.0 12.197651 12.195516 0.0 0.0 23.027297 24.371369 24.491928 164457.0 297.512394 297.490619 0.0 0.0 530.256410 593.963636 599.854545 164457.0 0.500106 0.500002 0.0 0.0 1.0 1.0 1.0 164457.0 0.499894 0.500002 0.0 0.0 0.0 1.0 1.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.500106 0.500002 0.0 0.0 1.0 1.0 1.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.500283 0.500427 0.0 0.0 1.0 1.0 2.0 164457.0 8.643638 8.642374 0.0 0.0 14.50 17.2 17.400000 164457.0 9.749339 9.753269 0.0 0.0 18.0 19.2 20.0 164457.0 7.558702 7.572162 0.0 0.0 12.000 15.6 16.666667 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 2.459804 2.466897 0.0 0.0 4.0 5.0 6.0 164457.0 47.981515 48.193465 0.0 0.0 72.0 96.0 100.0 164457.0 3.541515 1.553819 2.0 2.0 5.0 5.0 8.0 164457.0 38.461665 38.756286 0.0 0.0 72.0 78.0 100.0 164457.0 -1.0 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 164457.0 83.918684 0.996691 83.0 83.0 83.0 85.0 85.0 164457.0 1.000213 1.000003 0.0 0.0 2.0 2.0 2.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.003867 0.287735 0.0 0.0 0.0 0.0 36.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.003867 0.287735 0.0 0.0 0.0 0.0 36.0 164457.0 0.003867 0.287735 0.0 0.0 0.0 0.0 36.0 164457.0 20526.033231 1.423597e+06 0.0 0.0 0.0 0.0 117440559.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 20526.033231 1.423597e+06 0.0 0.0 0.0 0.0 117440559.0 164457.0 20526.033231 1.423597e+06 0.0 0.0 0.0 0.0 117440559.0
In [17]:
fw_36plc['Label'].unique()
Out[17]:
array(['mitm'], dtype=object)
In [18]:
fw_36plc['Label'] = 'mitm_36plc'
In [19]:
# Drop unnecessary columns
cols_to_drop = ['Flow ID', 'Src IP', 'Src Port', 'Dst IP', 'Dst Port', 'Timestamp']
#benign.drop(columns=cols_to_drop, errors='ignore', inplace=True)
scapy_modify.drop(columns=cols_to_drop, errors='ignore', inplace=True)
fw_36plc.drop(columns=cols_to_drop,errors='ignore', inplace=True)
In [20]:
# Merge
df = pd.concat([scapy_modify,fw_36plc], ignore_index=True)
In [21]:
df.groupby("Label").describe()
Out[21]:
Protocol Flow Duration Tot Fwd Pkts Tot Bwd Pkts TotLen Fwd Pkts TotLen Bwd Pkts Fwd Pkt Len Max Fwd Pkt Len Min Fwd Pkt Len Mean Fwd Pkt Len Std Bwd Pkt Len Max Bwd Pkt Len Min Bwd Pkt Len Mean Bwd Pkt Len Std Flow Byts/s Flow Pkts/s Flow IAT Mean Flow IAT Std Flow IAT Max Flow IAT Min Fwd IAT Tot Fwd IAT Mean Fwd IAT Std Fwd IAT Max Fwd IAT Min Bwd IAT Tot Bwd IAT Mean Bwd IAT Std Bwd IAT Max Bwd IAT Min Fwd PSH Flags Bwd PSH Flags Fwd URG Flags Bwd URG Flags Fwd Header Len Bwd Header Len Fwd Pkts/s Bwd Pkts/s Pkt Len Min Pkt Len Max Pkt Len Mean Pkt Len Std Pkt Len Var FIN Flag Cnt SYN Flag Cnt RST Flag Cnt PSH Flag Cnt ACK Flag Cnt URG Flag Cnt CWE Flag Count ECE Flag Cnt Down/Up Ratio Pkt Size Avg Fwd Seg Size Avg Bwd Seg Size Avg Fwd Byts/b Avg Fwd Pkts/b Avg Fwd Blk Rate Avg Bwd Byts/b Avg Bwd Pkts/b Avg Bwd Blk Rate Avg Subflow Fwd Pkts Subflow Fwd Byts Subflow Bwd Pkts Subflow Bwd Byts Init Fwd Win Byts Init Bwd Win Byts Fwd Act Data Pkts Fwd Seg Size Min Active Mean Active Std Active Max Active Min Idle Mean Idle Std Idle Max Idle Min
count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max count mean std min 25% 50% 75% max
Label
mitm 6754.0 6.0 0.0 6.0 6.0 6.0 6.0 6.0 6754.0 434630.275540 1.566391e+06 14.0 35.0 616202.5 792774.25 99088176.0 6754.0 2.449067 2.457426 0.0 0.0 4.0 5.0 6.0 6754.0 3.553154 1.569620 1.0 2.0 5.0 5.0 8.0 6754.0 47.787385 48.099579 0.0 0.0 72.0 98.0 168.0 6754.0 38.269174 38.660947 0.0 0.0 72.0 72.0 100.0 6754.0 33.752147 34.166059 0.0 0.0 44.0 70.0 72.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 9.749585 9.755739 0.0 0.0 18.0 19.6 28.0 6754.0 14.920295 15.028194 0.0 0.0 21.786846 30.672463 34.292856 6754.0 24.265028 24.886134 0.0 0.0 44.0 44.0 72.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 7.480942 7.496550 0.0 0.0 12.375 14.4 16.666667 6754.0 11.012655 11.146532 0.0 0.0 20.51341 20.513410 29.330303 6754.0 106.448680 107.724388 0.0 0.0 1.992790 216.632122 338.550777 6754.0 35418.533351 39916.649455 0.121104 12.613931 16.231172 57142.857143 142857.142857 6754.0 47810.307408 144692.168035 14.0 35.0 69502.500000 88088.583333 9.008016e+06 6754.0 61929.003762 455455.016393 0.0 0.0 75823.085052 105804.078147 2.963342e+07 6754.0 165512.691146 1.508231e+06 14.0 35.0 194066.0 276949.75 98355743.0 6754.0 63.708617 1664.419176 13.0 20.0 29.0 38.0 100501.0 6754.0 314562.587060 315999.420297 0.0 0.0 470988.5 628555.0 776518.0 6754.0 81354.608528 82457.804395 0.0 0.0 118766.25 158968.375 252569.00 6754.0 74244.508187 75455.695403 0.0 0.0 65767.341155 151067.292561 201558.904417 6754.0 154264.025318 155730.636886 0.0 0.0 204687.0 307223.25 438777.0 6754.0 6640.931744 18928.241434 0.0 0.0 1958.0 6095.25 135708.0 6754.0 431217.406574 1.565578e+06 0.0 35.0 609929.0 785992.25 99088176.0 6754.0 102895.405747 237557.336597 0.0 35.0 126171.9 194004.9125 1.415545e+07 6754.0 60112.545143 569092.745766 0.0 0.0 57030.169689 98073.563059 3.712901e+07 6754.0 173616.759994 1.508831e+06 0.0 35.0 213070.0 293905.25 98355743.0 6754.0 38636.816849 43667.114064 0.0 35.0 105.5 81205.25 151454.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 78.790643 78.922803 0.0 0.0 136.0 160.0 192.0 6754.0 121.288126 57.548323 44.0 64.0 176.0 176.0 264.0 6754.0 3.035348 3.084742 0.0 0.0 3.770851 6.213025 15.614265 6754.0 35415.498003 39919.342230 0.080736 6.368036 9.511096 57142.857143 142857.142857 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 35.010364 35.021639 0.0 0.0 68.0 70.0 72.0 6754.0 7.821808 7.821432 0.0 0.0 13.153846 15.636364 20.000000 6754.0 12.154557 12.152875 0.0 0.0 22.905756 24.371369 27.804512 6754.0 295.403750 295.439760 0.0 0.0 524.717949 593.963636 773.090909 6754.0 0.499704 0.500037 0.0 0.0 0.0 1.0 1.0 6754.0 0.499852 0.500037 0.0 0.0 0.0 1.0 1.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.500148 0.500037 0.0 0.0 1.0 1.0 1.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.500444 0.500629 0.0 0.0 1.0 1.0 2.0 6754.0 8.603843 8.603407 0.0 0.0 14.25 17.2 21.818182 6754.0 9.749585 9.755739 0.0 0.0 18.0 19.6 28.0 6754.0 7.480942 7.496550 0.0 0.0 12.375 14.4 16.666667 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 2.449067 2.457426 0.0 0.0 4.0 5.0 6.0 6754.0 47.787385 48.099579 0.0 0.0 72.0 98.0 168.0 6754.0 3.553154 1.569620 1.0 2.0 5.0 5.0 8.0 6754.0 38.269174 38.660947 0.0 0.0 72.0 72.0 100.0 6754.0 -1.0 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 6754.0 83.896062 0.994657 83.0 83.0 83.0 85.0 85.0 6754.0 1.000740 1.000740 0.0 0.0 2.0 2.0 3.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.008884 0.549823 0.0 0.0 0.0 0.0 41.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 0.008884 0.549823 0.0 0.0 0.0 0.0 41.0 6754.0 0.008884 0.549823 0.0 0.0 0.0 0.0 41.0 6754.0 25647.077584 1.503937e+06 0.0 0.0 0.0 0.0 98355743.0 6754.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6754.0 25647.077584 1.503937e+06 0.0 0.0 0.0 0.0 98355743.0 6754.0 25647.077584 1.503937e+06 0.0 0.0 0.0 0.0 98355743.0
mitm_36plc 188383.0 6.0 0.0 6.0 6.0 6.0 6.0 6.0 188383.0 65592.658149 1.536137e+06 5.0 11.0 60558.0 78157.50 119999986.0 188383.0 2.456639 2.464104 0.0 0.0 4.0 5.0 6.0 188383.0 3.545108 1.558325 2.0 2.0 5.0 5.0 8.0 188383.0 47.905904 48.129617 0.0 0.0 72.0 96.0 100.0 188383.0 38.543924 38.853495 0.0 0.0 72.0 78.0 100.0 188383.0 33.901817 34.226893 0.0 0.0 44.0 68.0 72.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 9.746797 9.750116 0.0 0.0 18.0 19.2 25.0 188383.0 14.965210 15.048824 0.0 0.0 21.786846 29.852973 34.000000 188383.0 24.539836 25.033469 0.0 0.0 44.0 50.0 72.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 7.563971 7.577124 0.0 0.0 12.000 15.6 16.666667 188383.0 11.127344 11.233186 0.0 0.0 20.51341 22.733236 29.330303 188383.0 1094.954881 1109.816059 0.0 0.0 2.007809 2210.650760 2991.746905 188383.0 90833.995794 99095.427321 0.100000 127.946774 165.130949 181818.181818 400000.000000 188383.0 6776.849563 139659.181256 5.0 11.0 6728.666667 8684.166667 1.090909e+07 188383.0 15207.344502 462689.885739 0.0 0.0 11859.989497 14094.021412 3.615716e+07 188383.0 49186.555385 1.534704e+06 5.0 11.0 37497.0 44321.00 119927029.0 188383.0 12.346714 5.497144 4.0 8.0 11.0 16.0 406.0 188383.0 34614.072215 35220.837825 0.0 0.0 51083.0 67361.0 229220.0 188383.0 8885.135330 9062.045093 0.0 0.0 13306.00 17228.750 57305.00 188383.0 10548.331855 10815.442744 0.0 0.0 15065.157716 19836.705001 99892.936230 188383.0 23655.525148 24129.986474 0.0 0.0 37500.0 44366.00 206711.0 188383.0 1217.281368 1417.517579 0.0 0.0 1204.0 2085.00 16531.0 188383.0 62640.287871 1.536110e+06 5.0 11.0 56631.0 72129.00 119999986.0 188383.0 12749.303370 219509.307229 5.0 11.0 12548.0 17757.5000 1.714286e+07 188383.0 19601.336573 579979.910079 0.0 0.0 14100.013163 18751.943017 4.532356e+07 188383.0 49405.281543 1.534704e+06 5.0 11.0 37921.0 44752.50 119927029.0 188383.0 1750.352845 2193.890666 5.0 11.0 65.0 2841.00 14882.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 78.965214 79.089035 0.0 0.0 136.0 160.0 192.0 188383.0 121.093007 57.296271 64.0 64.0 176.0 176.0 264.0 188383.0 31.116261 31.636463 0.0 0.0 0.046454 62.969913 87.624500 188383.0 90802.879533 99123.910254 0.066667 64.648763 95.632770 181818.181818 400000.000000 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 34.898733 34.916479 0.0 0.0 66.0 68.0 72.0 188383.0 7.858376 7.856614 0.0 0.0 13.384615 15.636364 17.200000 188383.0 12.198329 12.195228 0.0 0.0 23.027297 24.371369 25.231374 188383.0 297.522027 297.476984 0.0 0.0 530.256410 593.963636 636.622222 188383.0 0.500141 0.500001 0.0 0.0 1.0 1.0 1.0 188383.0 0.499859 0.500001 0.0 0.0 0.0 1.0 1.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 0.500141 0.500001 0.0 0.0 1.0 1.0 1.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 0.500422 0.500574 0.0 0.0 1.0 1.0 2.0 188383.0 8.644150 8.642232 0.0 0.0 14.50 17.2 19.111111 188383.0 9.746797 9.750116 0.0 0.0 18.0 19.2 25.0 188383.0 7.563971 7.577124 0.0 0.0 12.000 15.6 16.666667 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 2.456639 2.464104 0.0 0.0 4.0 5.0 6.0 188383.0 47.905904 48.129617 0.0 0.0 72.0 96.0 100.0 188383.0 3.545108 1.558325 2.0 2.0 5.0 5.0 8.0 188383.0 38.543924 38.853495 0.0 0.0 72.0 78.0 100.0 188383.0 -1.0 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 188383.0 83.912099 0.996132 83.0 83.0 83.0 85.0 85.0 188383.0 1.000292 1.000003 0.0 0.0 2.0 2.0 2.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 0.003668 0.236835 0.0 0.0 0.0 0.0 27.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 0.003668 0.236835 0.0 0.0 0.0 0.0 27.0 188383.0 0.003668 0.236835 0.0 0.0 0.0 0.0 27.0 188383.0 25559.405679 1.534908e+06 0.0 0.0 0.0 0.0 119927029.0 188383.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 188383.0 25559.405679 1.534908e+06 0.0 0.0 0.0 0.0 119927029.0 188383.0 25559.405679 1.534908e+06 0.0 0.0 0.0 0.0 119927029.0
normal 164457.0 6.0 0.0 6.0 6.0 6.0 6.0 6.0 164457.0 58148.334805 1.424615e+06 7.0 14.0 57859.0 73380.00 117511126.0 164457.0 2.459804 2.466897 0.0 0.0 4.0 5.0 6.0 164457.0 3.541515 1.553819 2.0 2.0 5.0 5.0 8.0 164457.0 47.981515 48.193465 0.0 0.0 72.0 96.0 100.0 164457.0 38.461665 38.756286 0.0 0.0 72.0 78.0 100.0 164457.0 33.978535 34.284204 0.0 0.0 44.0 68.0 72.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 9.749339 9.753269 0.0 0.0 18.0 19.2 20.0 164457.0 14.990621 15.069873 0.0 0.0 21.786846 29.852973 31.496031 164457.0 24.458685 24.926832 0.0 0.0 44.0 50.0 72.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 7.558702 7.572162 0.0 0.0 12.000 15.6 16.666667 164457.0 11.102558 11.203735 0.0 0.0 20.51341 22.733236 29.330303 164457.0 1164.924351 1180.243370 0.0 0.0 1.803155 2355.486778 3057.083121 164457.0 71186.095216 78249.038332 0.102118 136.278772 172.962502 142857.142857 285714.285714 164457.0 6053.155641 129522.082678 7.0 14.0 6424.000000 8153.222222 1.068283e+07 164457.0 13498.581455 429158.498273 0.0 0.0 11627.964869 13719.697409 3.540754e+07 164457.0 43585.339639 1.423458e+06 7.0 14.0 36986.0 43238.00 117440559.0 164457.0 16.784807 9.151835 4.0 11.0 14.0 22.0 2064.0 164457.0 34062.665639 34647.273340 0.0 0.0 50543.0 66317.0 156975.0 164457.0 8727.146386 8898.843536 0.0 0.0 13176.00 16922.000 39243.75 164457.0 10256.294977 10501.460605 0.0 0.0 14713.764316 19285.950368 68549.944913 164457.0 23079.325629 23513.684397 0.0 0.0 37016.0 43284.00 141872.0 164457.0 1221.682902 1431.210742 0.0 0.0 1239.0 2082.00 19406.0 164457.0 55162.797917 1.424580e+06 7.0 14.0 54144.0 67067.00 117511126.0 164457.0 11443.127877 203580.924270 7.0 14.0 11946.6 16542.2500 1.678730e+07 164457.0 17682.778109 537956.338481 0.0 0.0 14333.896201 18761.503636 4.438392e+07 164457.0 43794.498726 1.423459e+06 7.0 14.0 37471.0 43664.00 117440559.0 164457.0 1716.652025 2087.730052 7.0 14.0 103.0 3182.00 13849.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 79.039846 79.159871 0.0 0.0 136.0 160.0 192.0 164457.0 121.004080 57.193933 64.0 64.0 176.0 176.0 264.0 164457.0 33.152261 33.689838 0.0 0.0 0.041677 67.281168 96.677516 164457.0 71152.942954 78279.141975 0.068079 68.809865 100.446989 142857.142857 285714.285714 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 34.897913 34.918514 0.0 0.0 66.0 68.0 72.0 164457.0 7.857901 7.856737 0.0 0.0 13.384615 15.636364 15.818182 164457.0 12.197651 12.195516 0.0 0.0 23.027297 24.371369 24.491928 164457.0 297.512394 297.490619 0.0 0.0 530.256410 593.963636 599.854545 164457.0 0.500106 0.500002 0.0 0.0 1.0 1.0 1.0 164457.0 0.499894 0.500002 0.0 0.0 0.0 1.0 1.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.500106 0.500002 0.0 0.0 1.0 1.0 1.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.500283 0.500427 0.0 0.0 1.0 1.0 2.0 164457.0 8.643638 8.642374 0.0 0.0 14.50 17.2 17.400000 164457.0 9.749339 9.753269 0.0 0.0 18.0 19.2 20.0 164457.0 7.558702 7.572162 0.0 0.0 12.000 15.6 16.666667 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 2.459804 2.466897 0.0 0.0 4.0 5.0 6.0 164457.0 47.981515 48.193465 0.0 0.0 72.0 96.0 100.0 164457.0 3.541515 1.553819 2.0 2.0 5.0 5.0 8.0 164457.0 38.461665 38.756286 0.0 0.0 72.0 78.0 100.0 164457.0 -1.0 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 164457.0 83.918684 0.996691 83.0 83.0 83.0 85.0 85.0 164457.0 1.000213 1.000003 0.0 0.0 2.0 2.0 2.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.003867 0.287735 0.0 0.0 0.0 0.0 36.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 0.003867 0.287735 0.0 0.0 0.0 0.0 36.0 164457.0 0.003867 0.287735 0.0 0.0 0.0 0.0 36.0 164457.0 20526.033231 1.423597e+06 0.0 0.0 0.0 0.0 117440559.0 164457.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 164457.0 20526.033231 1.423597e+06 0.0 0.0 0.0 0.0 117440559.0 164457.0 20526.033231 1.423597e+06 0.0 0.0 0.0 0.0 117440559.0
In [25]:
import seaborn as sns
import matplotlib.pyplot as plt

for col in df.select_dtypes(include='number').columns:
    plt.figure(figsize=(12, 4))
    sns.boxplot(y='Label', x=col, data=df)
    plt.title(f'Boxplot of {col} by Label')
    plt.show()
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
In [26]:
for col in df.select_dtypes(include='number').columns:
    plt.figure(figsize=(12, 4))
    sns.violinplot(y='Label', x=col, data=df)
    plt.title(f'Violin plot of {col} by Label')
    plt.show()
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
In [33]:
from scipy.stats import ttest_ind

label_values = df['Label'].unique()
group1 = df[df['Label'] == label_values[0]]
group2 = df[df['Label'] == label_values[1]]

for col in df.select_dtypes(include='number').columns:
    stat, p = ttest_ind(group1[col], group2[col], nan_policy='omit')
    print(f'{col}: t={stat:.2f}, p={p:.4f}')
Protocol: t=nan, p=nan
Flow Duration: t=-21.20, p=0.0000
Tot Fwd Pkts: t=0.35, p=0.7259
Tot Bwd Pkts: t=-0.60, p=0.5465
TotLen Fwd Pkts: t=0.32, p=0.7456
TotLen Bwd Pkts: t=0.40, p=0.6891
Fwd Pkt Len Max: t=0.53, p=0.5948
Fwd Pkt Len Min: t=nan, p=nan
Fwd Pkt Len Mean: t=-0.00, p=0.9984
Fwd Pkt Len Std: t=0.38, p=0.7070
Bwd Pkt Len Max: t=0.63, p=0.5314
Bwd Pkt Len Min: t=nan, p=nan
Bwd Pkt Len Mean: t=0.83, p=0.4080
Bwd Pkt Len Std: t=0.65, p=0.5180
Flow Byts/s: t=73.69, p=0.0000
Flow Pkts/s: t=37.37, p=0.0000
Flow IAT Mean: t=-25.84, p=0.0000
Flow IAT Std: t=-9.07, p=0.0000
Flow IAT Max: t=-6.88, p=0.0000
Flow IAT Min: t=-11.43, p=0.0000
Fwd IAT Tot: t=-316.62, p=0.0000
Fwd IAT Mean: t=-315.29, p=0.0000
Fwd IAT Std: t=-283.50, p=0.0000
Fwd IAT Max: t=-273.95, p=0.0000
Fwd IAT Min: t=-108.79, p=0.0000
Bwd IAT Tot: t=-21.18, p=0.0000
Bwd IAT Mean: t=-35.93, p=0.0000
Bwd IAT Std: t=-6.34, p=0.0000
Bwd IAT Max: t=-7.33, p=0.0000
Bwd IAT Min: t=-333.73, p=0.0000
Fwd PSH Flags: t=nan, p=nan
Bwd PSH Flags: t=nan, p=nan
Fwd URG Flags: t=nan, p=nan
Bwd URG Flags: t=nan, p=nan
Fwd Header Len: t=0.25, p=0.7998
Bwd Header Len: t=-0.40, p=0.6892
Fwd Pkts/s: t=73.45, p=0.0000
Bwd Pkts/s: t=37.32, p=0.0000
Pkt Len Min: t=nan, p=nan
Pkt Len Max: t=-0.26, p=0.7954
Pkt Len Mean: t=0.37, p=0.7113
Pkt Len Std: t=0.28, p=0.7759
Pkt Len Var: t=0.57, p=0.5680
FIN Flag Cnt: t=0.06, p=0.9483
SYN Flag Cnt: t=0.01, p=0.9946
RST Flag Cnt: t=nan, p=nan
PSH Flag Cnt: t=nan, p=nan
ACK Flag Cnt: t=-0.01, p=0.9946
URG Flag Cnt: t=nan, p=nan
CWE Flag Count: t=nan, p=nan
ECE Flag Cnt: t=nan, p=nan
Down/Up Ratio: t=-0.03, p=0.9793
Pkt Size Avg: t=0.37, p=0.7107
Fwd Seg Size Avg: t=-0.00, p=0.9984
Bwd Seg Size Avg: t=0.83, p=0.4080
Fwd Byts/b Avg: t=nan, p=nan
Fwd Pkts/b Avg: t=nan, p=nan
Fwd Blk Rate Avg: t=nan, p=nan
Bwd Byts/b Avg: t=nan, p=nan
Bwd Pkts/b Avg: t=nan, p=nan
Bwd Blk Rate Avg: t=nan, p=nan
Subflow Fwd Pkts: t=0.35, p=0.7259
Subflow Fwd Byts: t=0.32, p=0.7456
Subflow Bwd Pkts: t=-0.60, p=0.5465
Subflow Bwd Byts: t=0.40, p=0.6891
Init Fwd Win Byts: t=nan, p=nan
Init Bwd Win Byts: t=1.83, p=0.0675
Fwd Act Data Pkts: t=-0.04, p=0.9661
Fwd Seg Size Min: t=nan, p=nan
Active Mean: t=-1.34, p=0.1815
Active Std: t=nan, p=nan
Active Max: t=-1.34, p=0.1815
Active Min: t=-1.34, p=0.1815
Idle Mean: t=-0.29, p=0.7725
Idle Std: t=nan, p=nan
Idle Max: t=-0.29, p=0.7725
Idle Min: t=-0.29, p=0.7725
/home/ics-security/anaconda3/envs/DATN/lib/python3.9/site-packages/scipy/stats/_axis_nan_policy.py:531: RuntimeWarning: Precision loss occurred in moment calculation due to catastrophic cancellation. This occurs when the data are nearly identical. Results may be unreliable.
  res = hypotest_fun_out(*samples, **kwds)
In [ ]:
# from sklearn.preprocessing import LabelEncoder

# # Create and fit the encoder
# le = LabelEncoder()
# df['Label_encoded'] = le.fit_transform(df['Label'])

# # Create mapping dictionary
# label_mapping = dict(zip(le.classes_, le.transform(le.classes_)))

# print("Label to Integer Mapping:")
# for label, code in label_mapping.items():
#     print(f"'{label}' → {code}")
Label to Integer Mapping:
'mitm' → 0
'mitm_36plc' → 1
'normal' → 2
In [ ]:
# reverse_mapping = dict(zip(le.transform(le.classes_), le.classes_))

# print("\nInteger to Label Mapping:")
# for code, label in reverse_mapping.items():
#     print(f"{code} → '{label}'")
Integer to Label Mapping:
0 → 'mitm'
1 → 'mitm_36plc'
2 → 'normal'
In [ ]: